home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / GB-PVR 1.2.13 / GBPVR10213.msi / Cabs.w1.cab / Ajax_Calls.cs372 < prev    next >
Text File  |  2008-02-23  |  3KB  |  99 lines

  1. using System;
  2. using System.Collections;
  3. using System.Diagnostics;
  4. using System.Web.Script.Services;
  5. using System.Web.Services;
  6. using GBPVR.Public;
  7. using GBPVRSchedule;
  8.  
  9. /// <summary>
  10. /// Summary description for Ajax_Calls
  11. /// </summary>
  12. /// 
  13. namespace gbweb.classes
  14. {
  15.     [ScriptService]
  16.     public class Ajax_Calls : WebService
  17.     {
  18.         [WebMethod]
  19.         public string GetServerTime()
  20.         {
  21.             return DateTime.Now.ToLongTimeString().Trim();
  22.         }
  23.  
  24.         [WebMethod]
  25.         public string GetReminders()
  26.         {
  27.             
  28.             Settings guideParams = Global.Settings;
  29.             Schedule scheduleHelper = Global.Schedule;
  30.             ArrayList reminders = scheduleHelper.GetReminderList();
  31.             string temptitle = string.Empty;
  32.             string returnReminders = string.Empty;
  33.             string onclick = string.Empty;
  34.             string href = string.Empty;
  35.             foreach (Programme reminder in reminders)
  36.             {
  37.                 TimeSpan span = reminder.getStartTime() - DateTime.Now;
  38.                 int minutes = span.Minutes;
  39.                 if (span.Days > 0)
  40.                 {
  41.                     minutes = minutes + ((span.Days * 24) * 60);
  42.                 }
  43.                 if (span.Hours > 0)
  44.                 {
  45.                     minutes = minutes + (span.Hours * 60);
  46.                 }
  47.                 if ((minutes <= Convert.ToInt32(guideParams.reminder) && minutes > 0) || (minutes == 0 && span.Seconds < -30))
  48.                 {
  49.                     href = "Details.aspx?id=" + reminder.getOID();
  50.                     ScheduledRecording checkSchedule = scheduleHelper.GetScheduledRecordingByOID(reminder.getOID());
  51.                     if ( checkSchedule != null)
  52.                     {
  53.                         href += "&rid=" + reminder.getOID();
  54.                     }
  55.                     onclick = " onclick=\"EditPop5(this.href,'Add2');return false;\"";
  56.                     temptitle += "<span class=\"timeHighlight\">" + reminder.getStartTime().ToShortDateString() + " " + reminder.getStartTime().ToShortTimeString() + "</span> " + 
  57.                             reminder.getTitle();
  58.                     temptitle = "<a href=\"" + href + "\"" + onclick + ">" + temptitle + "</a><br>";
  59.                     returnReminders += temptitle;
  60.                     temptitle = string.Empty;
  61.                 }
  62.             }
  63.             if (returnReminders != string.Empty)
  64.             {
  65.                 reminders.Clear();
  66.                 reminders.TrimToSize();
  67.                 return returnReminders;
  68.             }
  69.             else
  70.             {
  71.                 reminders.Clear();
  72.                 reminders.TrimToSize();
  73.                 return "";  
  74.             }
  75.         }
  76.  
  77.         [WebMethod]
  78.         public string GetStreamerStatus()
  79.         {
  80.             string streamActive = "";
  81.             //Check processes running on the seerver.  If VLC is running assuming streaming is active
  82.             try
  83.             {
  84.                 foreach (Process thisproc in Process.GetProcessesByName("vlc"))
  85.                 {
  86.                     streamActive = "true";
  87.                     continue;
  88.                 }
  89.             }
  90.             catch (Exception Exc)
  91.             {
  92.             }
  93.  
  94.             return streamActive;
  95.         }
  96.     }
  97. }
  98.  
  99.